using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Movies.Infrastructure.Data;

var builder = WebApplication.CreateBuilder(args);



//数据库上下文注入
builder.Services.AddDbContext<MovieContext>(options =>
{
    var msSqlConnection =
        builder.Configuration.GetConnectionString("MovieConnection")
        ?? throw new InvalidOperationException("MsSqlConnection在appsettings.json未发现");
    options.UseSqlServer(
        msSqlConnection,
        b => b.MigrationsAssembly(Assembly.GetExecutingAssembly().FullName)
    );
});

var app = builder.Build();
app.Run();


